package HBaseIA.TwitBase.myTest;

import org.apache.hadoop.hbase.util.Bytes;
import utils.Md5Utils;

public class Test {
    public static void main(String[] args) {
        byte[] userHash = Md5Utils.md5sum("abc");//length为16,将用户唯一标识散列化
        byte[] timestamp = Bytes.toBytes(-1 * 1631784225309L);//length为8
        System.out.println("userHash.length:"+userHash.length);
        for (byte hash : userHash) {
            System.out.print(hash+",");
        }
        System.out.println("\n");
        System.out.println("timestamp.length:"+timestamp.length);
        for (byte t : timestamp) {
            System.out.print(t+",");
        }
        byte[] userHash1 = Md5Utils.md5sum("abc");
        byte[] startRow = Bytes.padTail(userHash1, 8); // 212d...866f00...
        byte[] stopRow = Bytes.padTail(userHash1, 8);
        stopRow[Md5Utils.MD5_LENGTH-1]++;
        System.out.println("\n");
        System.out.println("startRow.length:"+startRow.length);
        for (byte b : startRow) {
            System.out.print(b+",");
        }
        System.out.println("\n");
        System.out.println("stopRow.length:"+stopRow.length);
        for (byte b : stopRow) {
            System.out.print(b+",");
        }
    }
}
